/*
 *  This file is part of Spidex.
 *  
 *  Spidex is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  Spidex is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with Spidex.  If not, see <http://www.gnu.org/licenses/>.
 */

package spidex.importer;

import java.util.Vector;

/**
 *
 * @author xatrix
 */
public class ColumnType {
    private final int type;
    private final String stringType;
    
    private ColumnType(int type, String stringType) {
        this.type = type;
        this.stringType = stringType;
    }
    
    public int getInt() {
        return this.type;
    }
    
    public final static ColumnType Undefined = new ColumnType(0,"Undefined");
    public final static ColumnType Name = new ColumnType(1,"Name");
    public final static ColumnType Compilation = new ColumnType(2,"Compilation");
    public final static ColumnType Rating = new ColumnType(3,"Rating");
    public final static ColumnType Lend = new ColumnType(4,"Lend");
    public final static ColumnType Borrow = new ColumnType(5,"Borrow");
    public final static ColumnType Info = new ColumnType(6,"Info");
    public final static ColumnType Genre = new ColumnType(7,"Genre");
    
    public final static ColumnType getType(int value) {
        switch(value) {
            case 1: return ColumnType.Name;
            case 2: return ColumnType.Compilation;
            case 3: return ColumnType.Rating;
            case 4: return ColumnType.Lend;
            case 5: return ColumnType.Borrow;
            case 6: return ColumnType.Info;
            case 7: return ColumnType.Genre;
            default: return ColumnType.Undefined;   
        }
    }
    
    public boolean equals(ColumnType val) {
        return ((Integer) this.type).equals( val.type );
    }
    
    @Override
    public String toString() {
        return this.stringType;
    }
    
    public final static Vector<String> getStringArray() {
        Vector<String> result = new Vector<String>();
        java.util.ResourceBundle bundle = 
            java.util.ResourceBundle.getBundle("spidex/properties");
        result.add( bundle.getString("name") );
        result.add( bundle.getString("compilation") );
        result.add( bundle.getString("rating") );
        result.add( bundle.getString("lend") );
        result.add( bundle.getString("borrowed") );
        result.add( bundle.getString("info") );
        result.add( bundle.getString("genre") );
        return result;
    }
}
